<form novalidate #f="ngForm" (ngSubmit)="onSubmit()" class="addpatient_form">
  <div class="addpatient_box">
    <div class="weui-cell">
      <div class="weui-cell__hd">
        <label class="weui-label">姓名</label>
      </div>
      <div class="weui-cell__bd">
        <input [(ngModel)]="name" #nameRef="ngModel" class="weui-input" type="text" name="name" placeholder="填写真实姓名" required pattern="^[a-zA-Z\u4e00-\u9fa5]+$">
      </div>
    </div>
    <div *ngIf="nameRef.invalid && (nameRef.dirty || nameRef.touched)">
      <div class="toptips" *ngIf="nameRef.errors.required||nameRef.errors.pattern">请输入正确的姓名</div>
    </div>
    <div class="weui-cell">
      <div class="weui-cell__hd">
        <label class="weui-label">身份证号</label>
      </div>
      <div class="weui-cell__bd">
        <input [(ngModel)]="idcard" #idRef="ngModel" class="weui-input" type="tel" name="ID" placeholder="取号时需出示身份证" required pattern="d{15}||d{18}"
          minlength="15" maxlength="18">
      </div>
    </div>
    <div *ngIf="idRef.invalid && (idRef.dirty || idRef.touched)">
      <div class="toptips" *ngIf="idRef.errors?.required||idRef.errors?.pattern||idRef.errors?.minlength||idRef.errors?.maxlength">请输入正确的身份证号码</div>
    </div>
    <div class="weui-cell">
      <div class="weui-cell__hd">
        <label class="weui-label">手机号码</label>
      </div>
      <div class="weui-cell__bd">
        <input [(ngModel)]="mobile" #mobileRef="ngModel" class="weui-input" type="tel" name="手机号" placeholder="用于接收确认短信" required
          minlength="11" maxlength="11" pattern="^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$">
      </div>
    </div>
    <div *ngIf="mobileRef.invalid && (mobileRef.dirty || mobileRef.touched)">
      <div class="toptips" *ngIf="mobileRef.errors?.pattern||mobileRef.errors?.minlength||mobileRef.errors?.maxlength">请输入正确的手机号码</div>
    </div>
    <!-- <div class="weui-cell">
      <div class="weui-cell__hd">
        <label class="weui-label">就诊卡号</label>
      </div>
      <div class="weui-cell__bd">
        <input [(ngModel)]="cardId" #cardRef="ngModel" class="weui-input" type="tel" name="就诊卡号" placeholder="没有就诊卡取号时补办" pattern="^[0-9]*$">
      </div>
    </div>
    <div *ngIf="cardRef.invalid && (cardRef.dirty || cardRef.touched)">
      <div class="toptips" *ngIf="cardRef.errors?.pattern">请输入正确的就诊卡号</div>
    </div> -->
  </div>
  <div class="weui-btn-area btn">
    <button class="weui-btn weui-btn_primary" [disabled]="!f.form.valid || !f.form.dirty" [ngClass]="{'weui-btn_disabled': !f.form.valid || !f.form.dirty}"
      (click)="addPatient()">保存</button>
  </div>
</form>
<weui-toast #success></weui-toast>
<weui-toast #loading [type]="'loading'"></weui-toast>
<div>
  <!-- <div footer class="weui-footer" style="padding-top: 70%">
    <p class="weui-footer__text">技术支持</p>
    <p class="weui-footer__text">©重庆钜元大数据有限公司</p>
  </div>-->
  <!-- <weui-toptips #toptips></weui-toptips>-->
</div>